﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Globalization;

namespace Obra.SmugMug.Api
{
    public static class SmugMugDateTime
    {
        const string SMUGMUG_DATETIME_FORMAT = "yyyy-MM-dd HH:mm:ss z";

        /// <summary>
        /// Parse a SmugMug date time string.
        /// </summary>
        /// <param name="dateTimeString">
        /// Date time string to parse, times are in PDT format.
        /// </param>
        public static DateTime Parse(string dateTimeString)
        {
            string dateTimeStringWithTimeZone = String.Format("{0} -8",
                dateTimeString);

            return DateTime.ParseExact(
                dateTimeStringWithTimeZone,
                SMUGMUG_DATETIME_FORMAT,
                CultureInfo.InvariantCulture);
        }
    }
}
